From: Daniel De Graaf Date: Mon, 20 Jun 2016 14:04:11 +0000 (-0400) Subject: flask/policy: split out rules for system_r X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~895 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=a2c8399a91bf868cc7359dde3c04fb7b6e0fa452;p=xen.git flask/policy: split out rules for system_r When the all_system_role module is enabled, any domain type can be created using the system_r role, which was the default. When it is disabled, domains not using the default types (dom0_t and domU_t) must use another role such as vm_r. Signed-off-by: Daniel De Graaf Reviewed-by: Konrad Rzeszutek Wilk Reviewed-by: Doug Goldstein --- diff --git a/tools/flask/policy/modules/all_system_role.te b/tools/flask/policy/modules/all_system_role.te new file mode 100644 index 0000000000..74f870f4e4 --- /dev/null +++ b/tools/flask/policy/modules/all_system_role.te @@ -0,0 +1,8 @@ +# Allow all domains to use system_r so that systems that are not using the +# user/role separation feature will work properly. +role system_r types domain_type; + +# The vm role is used as part of user separation. Allow all domain types to use +# this role except dom0. +role vm_r; +role vm_r types { domain_type -dom0_t }; diff --git a/tools/flask/policy/modules/domU.te b/tools/flask/policy/modules/domU.te index ca5eecd037..b77df29d56 100644 --- a/tools/flask/policy/modules/domU.te +++ b/tools/flask/policy/modules/domU.te @@ -23,3 +23,6 @@ make_device_model(dom0_t, dm_dom_t, domU_t) # This is required for PCI (or other device) passthrough delegate_devices(dom0_t, domU_t) + +# Both of these domain types can be created using the default (system) role +role system_r types { domU_t dm_dom_t }; diff --git a/tools/flask/policy/modules/modules.conf b/tools/flask/policy/modules/modules.conf index dba4b4089b..d875dbf531 100644 --- a/tools/flask/policy/modules/modules.conf +++ b/tools/flask/policy/modules/modules.conf @@ -32,3 +32,8 @@ nomigrate = on # Example device policy. Also see policy/device_contexts. nic_dev = on + +# This allows any domain type to be created using the system_r role. When it is +# disabled, domains not using the default types (dom0_t and domU_t) must use +# another role (such as vm_r) from the vm_role module. +all_system_role = on diff --git a/tools/flask/policy/modules/xen.te b/tools/flask/policy/modules/xen.te index 3ee5e7541f..f374dc58f4 100644 --- a/tools/flask/policy/modules/xen.te +++ b/tools/flask/policy/modules/xen.te @@ -78,12 +78,7 @@ neverallow * ~event_type:event { create send status }; # The object role (object_r) is used for devices, resources, and event channels; # it does not need to be defined here and should not be used for domains. -# The system role is used for utility domains and pseudo-domains +# The system role is used for utility domains and pseudo-domains. If roles are +# not being used for separation, all domains can use the system role. role system_r; -role system_r types { xen_type domain_type }; -# If you want to prevent domUs from being placed in system_r: -##role system_r types { xen_type dom0_t }; - -# The vm role is used for customer virtual machines -role vm_r; -role vm_r types { domain_type -dom0_t }; +role system_r types { xen_type dom0_t };